import json

import requests
import pandas as pd
import numpy as np

# 读取csv文件中的数据，假设文件名为data.csv，数据格式为(168,9)的数组

# init_data = pd.read_csv("../data/work.csv", usecols=list(range(1, 10)) ).values
#
# data = init_data[-168:].astype('float32').tolist()

# 将Python列表转换为JSON字符串
# data_json = json.dumps(data)

# 构造POST请求，将数据发送到Flask服务
url = 'http://127.0.0.1:5000/predict'
headers = {'Content-Type': 'application/json'}
# payload = {'data': data_json}
response = requests.post(url, headers=headers)

# 获取Flask服务返回的预测结果，并输出到控制台
prediction = response.json()
print(prediction)
